package edu.trinity.cs.cjenkin1.webcrawler;

import java.util.Iterator;

import org.htmlparser.Node;
import org.htmlparser.util.NodeIterator;
import org.htmlparser.util.ParserException;

public class NodeIterator2 implements Iterator<Node>, Iterable<Node> {

	private NodeIterator iter;
	
	public NodeIterator2(NodeIterator iter) {
		this.iter = iter;
	}
	
	public boolean hasNext() {
		try {
			return iter.hasMoreNodes();
		} catch(ParserException e) {
			return false;
		}
	}

	public Node next() {
		try {
			return iter.nextNode();	
		}
		catch(ParserException e) {
			return null;
		}
	}

	public void remove() {
		// TODO Auto-generated method stub
		// not implemented
	}

	public Iterator<Node> iterator() {
		// TODO Auto-generated method stub
		return this;
	}

}
